import {request} from 'umi';
import {AccountSetting} from "./data";

export async function accountSetting(): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/account/setting', {
    method: 'POST',
  });
}

export async function accountBind(): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/account-bind/list', {
    method: 'GET',
  });
}


export async function deleteBind(id: any): Promise<{ data: AccountSetting }> {
  return request(`/v2/enterprise/account-bind/${id}`, {
    method: 'DELETE',
  });
}


export async function bindWechat(): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/bind-wechat', {
    method: 'GET',
  });
}


export async function changePassword(params: any): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/account/password', {
    method: 'POST',
    data: params,
  });
}

export async function checkPhone(params: any): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/account/check', {
    method: 'POST',
    data: params,
  });
}

export async function changePhone(params: any): Promise<{ data: AccountSetting }> {
  return request('/v2/enterprise/account/phone', {
    method: 'POST',
    data: params,
  });
}

export async function accountSettingSave(params: AccountSetting) {
  return request<API.Result<void>>('/v2/enterprise/account/setting/save', {
    method: 'POST',
    data: params,
  });
}
